package com.admission.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class NewFileName {
	/**
	 * 
	 * @param fileName
	 *            文件名，取后缀需要
	 * @param curIndex
	 * @return
	 */
	public static String genNewFileName(String fileName, int curIndex) {
		SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
		String newFileName = sf.format(Calendar.getInstance().getTime());
		int beginIndex = fileName.lastIndexOf(".");

		if (beginIndex >= 0) {
			String fileExt = fileName.substring(beginIndex);
			newFileName = newFileName + curIndex + fileExt;
		}
		return newFileName;

	}
}
